package com.geqian.file.config;

import com.geqian.file.storage.AliyunOSSStorage;
import com.geqian.file.storage.LocalStorage;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author geqian
 * @date 16:30 2023/11/15
 */
@Configuration
public class FileStorageAutoConfiguration {


    @Bean
    @ConditionalOnClass(name = "com.aliyun.oss.OSSClient")
    public AliyunOSSStorage aliyunOSSStorage() {
        return new AliyunOSSStorage();
    }

    @Bean
    @ConditionalOnMissingClass(value = "com.aliyun.oss.OSSClient")
    public LocalStorage localStorage() {
        return new LocalStorage();
    }
}
